package top.shiyiri.servlet2;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Aunean
 * @date 2022/1/27 15:25
 */
public class Servlet2 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取请求的参数查看
        String username = request.getParameter("username");
        System.out.println("在Servlet2中查看参数：" + username);

        //查看 Servlet1中是否有值
        Object key = request.getAttribute("key");
        System.out.println("在Servlet2中查看Servlet1中的key值：" + key);

        //处理自己的
        System.out.println("Servlet2处理自己的业务");
    }
}
